{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Fibonacci: [  0.   1.   1.   2.   3.   5.   8.  13.  21.  34.  55.  89. 144. 233.\n",
      " 377.]\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "\n",
    "\n",
    "def fibonacci(x:int):\n",
    "    n = np.arange(0, x)\n",
    "    sqrt5 = np.sqrt(5)\n",
    "    phi = (1 + sqrt5)/2\n",
    "    fibonacci = np.rint((phi**n - (-1/phi)**n)/sqrt5)\n",
    "    return fibonacci\n",
    "print(\"Fibonacci:\", fibonacci(15))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 98,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Fibonacci: [  0   1   1   2   3   5   8  13  21  34  55  89 144 233 377]\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "\n",
    "\n",
    "F = np.matrix([[0, 1], [1, 1]])\n",
    "def fibonacci(x:int):\n",
    "    s = F[0,0]\n",
    "    for i in range(0,x-1):\n",
    "        n = (F ** i)[1,1]\n",
    "        s = np.hstack(([s,n]))\n",
    "    return s\n",
    "print(\"Fibonacci:\", fibonacci(15))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([1])"
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr = np.array([1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 88,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "matrix([[1, 1],\n",
       "        [1, 2]])"
      ]
     },
     "execution_count": 88,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "F = np.matrix([[0, 1], [1, 1]])\n",
    "F ** 3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
